The display and printing of images by computer systems often involves some manipulation of the images, for example through combining the images using compositing operations or by modification using blend, or blending, operations. Other manipulations such as colour mapping may also be performed.
In compositing, graphic objects with transparency data may be combined using operators such as the well-known Porter and Duff operators (described in “Compositing Digital Images”, Porter, T, Duff, T; Computer Graphics, Vol 18 No 3 (1984) pp 253-259), in which the opacity is modelled as the proportion of a pixel that is covered by opaque data. When combining colour and opacity from two Objects A and B (Source and Destination objects respectively), the pixel is divided into four regions, as illustrated in FIG. 1:                a region 10 where both objects are opaque, of area αAαB [Source and Destination objects];        a region 20 where only Object A is opaque, of area αA(1−αB) [Source object Only];        a region 30 where only Object B is opaque, of area αB(1−αA) [Destination object Only]; and        a region 40 where both objects are transparent, of area (1−αA)(1−αB) [No Source or Destination object],        
where:
αA=opacity (or “alpha”) of Object A
αB=opacity of Object B
The mathematical descriptions of these regions are used to define twelve compositing operators. All operators provide distinct combinations of these regions. Examples of the Porter and Duff operators applied to opaque objects are illustrated in FIG. 2A, and examples of the Porter and Duff operators applied to partially transparent objects are illustrated in FIG. 2B.
Porter and Duff operators can be summarised by three terms within a function that represent the three regions 10, 20, 30 that may be painted by any of the operators. The fourth region 40 where no source (Object A) or destination (Object B) colour is present cannot contribute to the resultant colour or opacity. The resultant colour multiplied by the resultant opacity at any pixel is given by:Cresultαresult=F(CA,CB)αAαB+Y·CAαA(1−αB)+Z·CBαB(1−αA)  (1)
where:
F(CA, CB)αAαB=a function selecting either the source or destination colour or no colour, multiplied by the product of the source and destination alpha. Hence this term can only be one of the following; CAαAαB, CBαAαB or 0. This term represents the [Source and Destination] region 10 in FIG. 1.
Y·CAαA(1−αB)=the product of the source colour, source opacity or alpha, complement of the destination opacity, and a binary factor (Y; either 1 or 0). This term represents the [Source Only] region 20 in FIG. 1.
Z·CBαB(1−αA)=the product of the destination colour, destination alpha, complement of the source opacity, and a binary factor (Z; either 1 or 0). This term represents the [Destination Only] region 30 in FIG. 1.
The resultant opacity at any point is given by:αresult=X·αAαB+Y·αA(1−αB)+Z·αB(1−αA)  (2)
where:
X·αAαB=the product of the source opacity, destination opacity, and a binary factor (X; either 1 or 0). This term represents the [Source and Destination] region 10 in FIG. 1.
Y·αA(1−αB)=the product of the source opacity, complement of the destination opacity, and the binary factor Y (either 1 or 0). This term represents the [Source Only] region 20 in FIG. 1.
Z·αB(1−αA)=the product of the destination opacity, complement of the source opacity, and the binary factor Z (either 1 or 0). This term represents the [Destination Only] region 30 in FIG. 1.
Table 1 lists the 12 Porter and Duff operators. A textual description is provided explaining how the operators relate to the equations and terms defined above.
TABLE 1The twelve Porter and Duff operatorsOperatorCresultαresultαresultF(CA, CB)XYZDescriptionclear000000None of the termsare used.srcCAαAαACA110Only the terms thatcontribute sourcecolour are used.dstCBαBαBCB101Only the terms thatcontribute destinationcolour are used.src-overCAαA +αA +CA111The source colour isCBαB(1 − αA)αB(1 − αA)placed over thedestination colour.dst-overCBαB +αB +CB111The destination colourCAαA(1 − αB)αA(1 − αB)is placed over thesource colour.src-inCAαAαBαAαBCA100The source thatoverlaps thedestination, replacesthe destination.dst-inCBαAαBαAαBCB100The destination thatoverlaps the source,replaces the source.src-outCAαA(1 − αB)αA(1 − αB)0010The source that doesnot overlap thedestination replacesthe destination.dst-outCBαB(1 − αA)αB(1 − αA)0001The destination thatdoes not overlap thesource replaces thesource.src-atopCAαAαB +αBCA101The source thatCBαB(1 − αA)overlaps thedestination iscomposited with thedestination.dst-atopCBαAαB +αACB110The destination thatCAαA(1 − αB)overlaps the source iscomposited with thesource and replacesthe destination.xorCAαA(1 − αB) +αA + αB −0011The non-overlappingCBαB(1 − αA)2αAαBregions of source anddestination arecombined.
It is common, however, only to use the src-over operator, where all three contributing regions 10, 20, 30 are used, and the colour of the region 10 where both objects are opaque is taken from the colour of the topmost (or source) object.
The src-over operator has also been used as the basis for blend, or blending, operations in systems where transparency data is used. In a blend operation, the source or blending object (Object A) or effect is used as a parameter of a blend function B that modifies the destination object (Object B). In the presence of transparency, the blend function operates on the region 10 where both objects are opaque, so that the src-over operator gives rise to an over-based blend operation:Cover-blendαover-blend=CAαA(1−αB)+CBαB(1−αA)+B(CA,CB)αAαB  (3)αover-blend=αA(1−αB)+αB(1−αA)+αAαB  (4)
where:
CA=colour of Object A;
CB=colour of Object B;
Cover-blend=resultant colour of over-based blend operation;
B(CA, CB)=blend function of Objects A and B;
αA=opacity of Object A;
αB=opacity of Object B; and
αover-blend=resultant opacity of over-based blend operation.
The src-over operator has the useful property that it does not modify pixels of the bottom object (Object B) outside the intersection of the two objects. However, a blend operation based on the src-over operator contains terms that include colour from both operands of the blending function. In some cases the resultant produced by an over-based blend operation may be undesirable. An example of such a case is described in the following three paragraphs.
When Object B is partially transparent i.e. αB<1, the colour of Object A contributes to the colour of the resultant other than through the blending function. FIG. 3A shows a partially transparent object 301 (Object B) and a blending object 302 (Object A). FIG. 3B shows the result 303 of blending the partially transparent object 301 (Object B) with the blending object 302 (Object A) using the over-based blending operation. In the example, the partially transparent object 301 (Object B) is a partially-transparent grey triangle. The blending object 302 (Object A) is a black square containing a circular region in which the colour varies radially from a black circumference to a white centre. In this particular case the blending operation uses a ‘dodge’ function. The ‘dodge’ function is described by the B(CA, CB) term in the over-based blend operation:
if (CA+CB)>=1B(CA,CB)=1  (5)elseB(CA,CB)=CB·1(1−CA)  (6)
It is noted that CA and CB are normalised colour values in range [0, 1]. If CA has a value of 1, no matter what value CB has, the term of B(CA, CB) will be equal to 1.
The objects, 301 and 302, are shown separately in FIG. 3A and the result 303 of using objects 301, 302 in an over-based blend operation is shown in FIG. 3B. Notice the black colour of Object A 302 darkening the destination colour in the overlapping area 310 of the two objects.
This effect is particularly noticeable in the ‘dodge’ and ‘burn’ blending operations. The ‘dodge’ operator is intended to brighten the destination (Object B) colour to reflect the source (Object A) colour. Performing a ‘dodge’ operation with black is intended to produce no change. The ‘burn’ operator is intended to be complementary, and darken the destination colour to reflect the source colour. Performing a ‘burn’ operation with white is intended to produce no change.
There exists a need to be able to modify the result of a blend operation in order to produce an alternative effect.